﻿/*
* ==============================================================================
*
* Filename: call_user_groupinfo_util
* Description: call_user_groupinfo_util
*
* Version: 1.0
* Created: 2020/8/25 18:04:03
* Compiler: Visual Studio 2019
*
* Author: Administrator
* Company: freelancer
*
* ==============================================================================
*/

namespace db_util {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using System.Threading.Tasks;
	using db_model;
	using MySql.Data.MySqlClient;

	public class call_user_groupinfo_util {
		public static call_user_groupinfo_model GetModel(string user_id) {
			var model = new call_user_groupinfo_model();
			string sql = "select id,user_id,group_id from call_user_groupinfo where user_id=?user_id limit 1";
			MySqlParameter[] parameters = {
	 new MySqlParameter("?user_id", MySqlDbType.VarChar,36)
				};
			parameters[0].Value = user_id;
			using (var dr = mysql_helper.GetDataReader(sql, parameters)) {
				if (dr.Read()) {
					model.id = int.Parse(dr["id"].ToString() == "" ? "-1" : dr["id"].ToString());
					model.user_id = dr["user_id"].ToString();
					model.group_id = dr["group_id"].ToString();
				}
			}
			return model;
		}

	}
}